import user from './user.js'
import error from './error.js'

const routes = [
    {
        path: '/index',
        name: 'index',
        meta: { title: '首页', icon: 'el-icon-s-home' },
        component: () => import('views/index.vue'),
    },
].concat(user, error)

function generateRouter(routes) {
    let routers = []
    for (let route of routes) {
        if (route.children) {
            routers = routers.concat(generateRouter(route.children))
        } else {
            routers.push(route)
        }
    }
    return routers
}

const routers = generateRouter(routes)

export { routes, routers }
